import importComponent from './import.vue'
let $vm
export default {
  install (Vue) {
    let ImportData = Vue.extend(importComponent)
    if (!$vm) {
      $vm = new ImportData({el: document.createElement('div')})
      document.body.appendChild($vm.$el)
    }
    const importDataConst = {
      open (url) {
        return $vm.open(url)
      },
      close () {
        $vm.close()
      }
    }
    Vue.$import = importDataConst
    Vue.mixin({
      created: function () {
        this.$import = Vue.$import
      }
    })
  }
}
